package com.fishery.authority.mapper;

import com.fishery.authority.entity.Function;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 711
 * @since 2021-01-13
 */
public interface FunctionMapper extends BaseMapper<Function> {
    /**
     * 通过查询userId得到roleId得到function集合
     *
     * @param userId
     * @return
     */
    List<Function> findByRoleIdByUserId(@Param("userId") String userId);

    /**
     * 通过查询baseId和baseIdentity得到function集合
     *
     * @param baseId
     * @param baseIdentity
     * @return
     */
    List<Function> findByBaseIdByBaseIdentity(@Param("baseId") String baseId,
                                              @Param("baseIdentity") Integer baseIdentity);

    /**
     * 查找该角色可以授权的权限
     *
     * @param roleId
     * @return
     */
    List<Function> findOthersByRoleId(String roleId);

    /**
     * 根据roleId和functionId，删除记录
     *
     * @param functionId
     * @param roleId
     */
    void deleteFunctionByRoleId(@Param("functionId") Object functionId, @Param("roleId") String roleId);

    List<Function> findByRoleId(String roleId);

    List<Function> findByBaseByBaseIdentity(String baseId, String baseIdentity);

    List<Function> findByName(String remarks);
}
